import request from '@/utils/request';

// 查询宏协议资源列表
export function queryAgreementResourceList(): ApiPromise<ApiResponse> {
	return request({
		url: '/management/option/protocol',
		method: 'get',
	});
}

// 根据业务服务资源编码查询业务服务资源
export function queryByCode(code: string): ApiPromise<ApiResponse> {
	return request({
		url: '/management/resource',
		method: 'post',
		data: {
			resourceCode: code,
		},
	});
}

// 查询业务服务资源列表
export function list(data: anyObj): ApiPromise<ApiResponse> {
	return request({
		url: '/management/resource',
		method: 'post',
		data: data,
	});
}

// 新增业务服务资源
export function add(data: anyObj): ApiPromise<ApiResponse> {
	return request({
		url: '/management/resource/save',
		method: 'post',
		data: data,
	});
}

// 修改业务服务资源
export function edit(data: anyObj): ApiPromise<ApiResponse> {
	return request({
		url: '/management/resource',
		method: 'put',
		data: data,
		// noSliceEmpty: true,
	});
}

// 删除业务服务资源
export function remove(ids: string): ApiPromise<ApiResponse> {
	return request({
		url: '/management/resource/delete/' + ids,
		method: 'delete',
	});
}

// 确认服务资源
export function confirmResource(ids: string): ApiPromise<ApiResponse> {
	return request({
		url: '/management/resource/confirmResource/' + ids,
		method: 'get',
	});
}

// 取消服务资源
export function cancelResource(ids: string): ApiPromise<ApiResponse> {
	return request({
		url: '/management/resource/cancelResource/' + ids,
		method: 'get',
	});
}

// 通过业务服务资源编码查询系统业务关联关系列表
export function querySysBusiRelationByResourceCode(data: anyObj): ApiPromise<ApiResponse> {
	return request({
		url: '/management/keyword/querySysBusiRelationByResourceCode',
		method: 'get',
		params: data,
	});
}

// 通过业务服务资源编码查询网端关联关系列表
export function querySegmentRelationByResourceCode(data: anyObj): ApiPromise<ApiResponse> {
	return request({
		url: '/management/keyword/querySegmentRelationByResourceCode',
		method: 'get',
		params: data,
	});
}
